set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)

message(STATUS "Searching for arm-none-gcc")

# The HINTS option should only be used for values computed from the system.
set(_ARM_NONE_GCC_HINTS
  ${ARM_NONE_GCC_PREFIX}
  ${ARM_NONE_GCC_PREFIX}/bin
  $ENV{ARM_NONE_GCC_PREFIX}
  $ENV{ARM_NONE_GCC_PREFIX}/bin
  ${CMAKE_INSTALL_PREFIX}
  ${CMAKE_INSTALL_PREFIX}/bin
)

# Hard-coded guesses should still go in PATHS. This ensures that the user
# environment can always override hard guesses.
set(_ARM_NONE_GCC_PATHS
  /usr/local/bin
  /usr/bin
  /bin
)

find_file(CMAKE_C_COMPILER
  NAMES arm-none-gcc
  HINTS ${_ARM_NONE_GCC_HINTS}
  PATHS ${_ARM_NONE_GCC_PATHS}
)

find_path(CMAKE_CXX_COMPILER
  NAMES arm-none-g++
  HINTS ${_ARM_NONE_GCC_HINTS}
  PATHS ${_ARM_NONE_GCC_PATHS}
)

# Where is the target environment
set(CMAKE_FIND_ROOT_PATH "/mnt" "/usr/arm-none-eabi")

# Search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# For libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

